import express from "express";
import { formatResponse } from "../../utils/tools";
import { AdminService } from "../../services/system/AdminService";
const router = express.Router();

router.get("/", async (req, res) => {
  const result = await AdminService.findByPage(
    req.query.current as unknown as number,
    req.query.size as unknown as number
  );

  res.send(formatResponse<typeof result>(result));
});

router.post("/", async (req, res) => {
  await AdminService.add(req.body);
  res.send(formatResponse<null>(null, "操作成功"));
});

export default router;
